<?php $this->load->view('common/admin_header');?>
<div class="block">
  <div class="block_head">
    <div class="bheadl"></div>
    <div class="bheadr"></div>
    <h2><?=$lang['orders_lable_3']?></h2>
    <ul>
      <li><a href="javascript:void(0)" onclick="javascript:history.go(-1)"><?=$lang['orders_lable_23']?></a></li>
    </ul>
  </div>
  <!-- .block_head ends -->
  <div class="block_content">
  <?php $this->load->view('common/notify');?>
  <form id="send_form" action="<?=site_url('admins/promotion/modify');?>" method="post">
    <input type="hidden" skip="true" name="redirect" value="<?=set_value('redirect',isset($redirect)?$redirect:'')?>">
    <?php if(isset($phone_data) && is_array($phone_data)):?>
    <p>
      <label>發送號碼:(僅支援澳門移動號碼)</label>
      <input type="hidden" validError="請先添加推廣號碼" name="phone_data" value='<?=serialize($phone_data)?>'>
      <ul id="phone_string">
        <?php foreach($phone_data as $phone):?>
        <li><i class="icon-phone-sign"></i> <?=$phone?></li>
        <?php endforeach;?>
      </ul>
    </p>
    <?php endif;?>
    <p>
      <label><?=$lang['orders_lable_21']?></label>
      <input type="text" skip="true" id="tags_1" class="text small tags" name='new_number_list' value="<?=set_value('new_number_list',isset($new_number_list)?$new_number_list:'')?>">
      <span class="note required"><?=$lang['orders_lable_79']?></span>
    </p>

    <p>
      <label><?=$lang['orders_lable_22']?></label>
      <textarea name="comment" validError="請輸入短信內容" style="width:99%;"><?=set_value('comment',isset($comment)?$comment:'')?></textarea>
    </p>
    <p>
      <input class="btn btn-primary" skip="true" type="submit" name="btn_save" value="<?=$lang['global_lable_12']?>" />
      <input class="btn" skip="true" type="reset" value="<?=$lang['global_lable_13']?>"/>
    </p>
  </form>
  </div>
  <!-- .block_content ends -->
  <div class="bendl"></div>
  <div class="bendr"></div>
</div>
<!-- .block ends -->
<link rel="stylesheet" href="<?=base_url('themes/admins/js/tagsinput/jquery.tagsinput.css')?>">
<script src="<?=base_url('themes/admins/js/tagsinput/jquery.tagsinput.min.js')?>"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
  $('#tags_1').tagsInput({width:'auto',defaultText:'phone'});//tags
  //發送短信
  $('#send_form').submit(function() {
    var is_validation=true;
    var validation_msg='';
    $('#send_form textarea,#send_form input').each(function() {
      var tmpname=$(this).attr('skip');
      if(tmpname || $(this).attr('id')=='tags_1_tag')
        return true;
      var tmptxt=$.trim($(this).val());
      if(tmptxt==''){
        console.log($(this).attr('name'));
        $(this).addClass('required');
        validation_msg+=$(this).attr('validError')+"\n";
        is_validation=false;
      }else{
        $(this).removeClass('required');
      }
    });

    if (is_validation) {
      return true;
    }
    alert(validation_msg);
    return false;
  });
});
</script>
<?php $this->load->view('common/admin_footer');?>